#ifndef SCRIPT_BASE_HPP
#define SCRIPT_BASE_HPP

#include <memory>

#include "gui/texture.hpp"
#include "scripting/scripting_api.h"

class ScriptExtension {
public:
    ScriptExtension(IScript* script, double time);
    ~ScriptExtension();
    ScriptExtension(const ScriptExtension&) = delete;
    ScriptExtension& operator=(const ScriptExtension&) = delete;
    [[nodiscard]] ScriptUsage usage() const;
    [[nodiscard]] TexturePtr icon() const;
    [[nodiscard]] const char *title() const;
    [[nodiscard]] const char *file() const;
    [[nodiscard]] bool reloadable() const;
    [[nodiscard]] double time() const;
    bool reload();
    bool call(const void* arg = {}) const;
private:
    friend struct ExtensionManagerData;

    IScript     *script_;
    double const file_time_;
};

using ScriptPtr = std::shared_ptr<ScriptExtension>;

#endif /* SCRIPT_BASE_HPP */
